package org.tsp.android.SensorExample;

import org.tsp.android.SensorExample.R;

import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class SensorsExampleActivity extends Activity {
	
	private SensorManager m_sensorMngr;
	private SensorListener m_Sensor;
	private Sensor m_acc;
	
	private LocationManager m_locMngr;
	private myLocationListener m_locLstrn;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
    }
    
    @Override
    public void onStart()
    {	
    	super.onStart();
    	
    	m_Sensor = new SensorListener();
        m_Sensor.act = this;
        m_sensorMngr = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
        m_acc = m_sensorMngr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
        
        //m_locMngr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
        //m_locLstrn = new myLocationListener();
    }
    
    @Override
    public void onResume()
    {
    	super.onResume();
    	// To Complete
    	// Start listeners
    }
    
    @Override
    public void onPause()
    {
    	super.onPause();
    	// To Complete
    	// Stop Listeners
    }
    
    @Override
    public void onStop()
    {
    	super.onStop();
    	
    	m_Sensor = null;
    	m_acc = null;
    }
    
    public void setText(String value)
    {
    	final String text = value;
    	runOnUiThread(new Runnable() {
			public void run() {
				//To complete 
				// Set text 
			}
		});
    }
    
}